package com.stms.pojo;

import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.sql.Date;

@Entity
@Table(name = "contract")
@Data
public class Contract {
    /**
     * 实体类属性分别为：id、订单编号、货物名称、货物类型、货物重量
     * 发货人编号、发货人姓名、发货人电话、发货地址
     * 收货人编号、收货人姓名、收货人电话、收货地址、发货日期、距离、运费
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @OneToOne
    @JoinColumn(name="send_id",referencedColumnName="id",nullable=false)
    private SendClient sendClient;

    @OneToOne
    @JoinColumn(name="receive_id",referencedColumnName="id",nullable=false)
    private ReceiveClient receiveClient;

    private String cargo;

    private String type;

    private Double value;

    private Double  weight;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date sendDate;

    @Transient
    private Date startDate;

    @Transient
    private Date endDate;

    private  Integer standardWeight;

    private Double weightUnitCost;

    private Double distanceUnitCost;

    private Double continuedWeight;

    private Double distance;

    private Double cost;
}
